package com.solomiao.demo.multi.thread.demo11;

public class DeadLockRunnableDemo2 implements Runnable {

    @Override
    public void run() {
        synchronized (MainDemo11.pen){
            System.out.println("线程2拿到笔了");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            synchronized (MainDemo11.paper){
                System.out.println("线程2拿到纸了");
                System.out.println("线程2写下：Hello World");
            }
        }
    }

}
